package chixing.day06.homework;

/**
 * 属性：vipLevel（VIP等级，1~5）
 * 构造函数：通过 super 初始化 username 和 points，并初始化 vipLevel
 * 方法：canAccessSpecialSale()，如果 vipLevel >= 3，返回 true，否则 false
 */
public class VIPUser extends User{
    private int vipLevel;

    public VIPUser(){}
    public VIPUser(int vipLevel) {
        this.vipLevel = vipLevel;
    }

    public VIPUser(String userName, double points, int vipLevel) {
        super(userName, points);
        this.vipLevel = vipLevel;
    }

    /**
     * 判断是否vipLevel >= 3
     * @return 是返回true否则返回false
     */
    public boolean canAccessSpecialSale(){
        if (vipLevel >= 3)
            return true;
        return false;
    }

    public int getVipLevel() {
        return vipLevel;
    }

    public void setVipLevel(int vipLevel) {
        this.vipLevel = vipLevel;
    }

    @Override
    public String toString() {
        return "VIPUser{" +
                "vipLevel=" + vipLevel +
                '}';
    }
}
